package nl.ajonker.railroad.ui.drawcommand;

import java.awt.*;

public class DrawTrackCommand {

    public static final Color railColor = Color.BLACK;
    public static final Stroke stroke = new BasicStroke(7, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER);

    public void draw(Point start, Graphics2D g2d, int dimension) {
        g2d.setStroke(stroke);
        g2d.setColor(railColor);

        g2d.drawOval(start.x, start.y, dimension * 4, dimension * 4);
        g2d.drawOval(start.x + dimension * 4, start.y, dimension * 4, dimension * 4);
        g2d.drawOval(start.x + 8 * dimension, start.y, dimension * 4, dimension * 4);

        g2d.drawLine(start.x + dimension * 2, start.y, start.x + 10 * dimension, start.y);
        g2d.drawLine(start.x + dimension * 2, start.y + dimension * 4, start.x + 10 * dimension, start.y + dimension * 4);

        g2d.drawLine(start.x + dimension * 2, start.y + (int) Math.round(-dimension * 0.5), start.x + 10 * dimension, start.y + (int) Math.round(-dimension * 0.5));
        g2d.drawLine(start.x + dimension * 2, start.y + (int) Math.round(dimension * 4.5), start.x + 10 * dimension, start.y + (int) Math.round(dimension * 4.5));

    }
}
